#include <bits/stdc++.h>
using namespace std;
#define N 1000005
int t, n, c[N];
int ans[3] = {1,0,8};
int main() {
    freopen("color.in", "r", stdin);
    freopen("color.out", "w", stdout);
    scanf("%d", &t);
    while (t--) {
        scanf("%d", &n);
        for (int i = 1; i <= n; i++) {
            scanf("%d", &c[i]);
        }
    }
    for (int i = 0; i < 3; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}